package com.qumitech.visualnovel.service.prop.impl;

import com.alibaba.fastjson.JSONObject;
import com.qumitech.visualnovel.component.util.HttpInvokeUtil;
import com.qumitech.visualnovel.model.common.BaseRsp;
import com.qumitech.visualnovel.model.common.UrlConstant;
import com.qumitech.visualnovel.service.prop.PropService;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author ywxie
 * @date 2019/12/26 17:07
 * @description
 */
@Service
public class PropServiceImpl implements PropService {

    private static final String USER_PROP_URL = "/admin/prop";

    @Override
    public BaseRsp listUserPropAdmin(Map<String, String> paramMap) {
        String url = UrlConstant.SERVER_URL + USER_PROP_URL;
        String body = HttpInvokeUtil.httpGet(url, paramMap, null);
        BaseRsp rsp = JSONObject.parseObject(body, BaseRsp.class);
        return rsp;
    }

    @Override
    public BaseRsp listPropTypeCfg() {
        String url = UrlConstant.SERVER_URL + USER_PROP_URL + "/config";
        String body = HttpInvokeUtil.httpGet(url, null, null);
        BaseRsp rsp = JSONObject.parseObject(body, BaseRsp.class);
        return rsp;
    }
}
